<? 
include_once("codelibrary/inc/variables.php");
include_once("session.php");
include_once("codelibrary/inc/functions.php");

$business_id = $_SESSION['business_id'];

if(isset($_REQUEST['Submit']))
{
	$appointment = $_REQUEST['appointment'];
	$appointment1 = $_REQUEST['appointment1'];
		if($appointment1 != "")
		{
			$appoint = $appointment1;
		}else
		{
			$appoint = $appointment;
		}
	
	$customer = $_REQUEST['customer'];
	$customer1 = $_REQUEST['customer1'];
		if($customer1 != "")
		{
			$cust = $customer1;
		}else
		{
			$cust = $customer;
		}
	
	$people = $_REQUEST['people'];
	$people1 = $_REQUEST['people1'];
		if($people1 != "")
		{
			$peop = $people1;
		}else
		{
			$peop = $people;
		}

	$who = $_REQUEST['who'];
	$who1 = $_REQUEST['who1'];
		if($who1 != "")
		{
			$w = $who1;
		}else
		{
			$w = $who;
		}

		$query = "insert into appointment_setting (setting_name,setting_value,business_id) values('appointment_name','".$appoint."','$business_id')";
		mysql_query($query) or die(mysql_error().'<br/>'.$query);
		
		$query = "insert into appointment_setting (setting_name,setting_value,business_id) values('customer_name','".$cust."','$business_id')";
		mysql_query($query) or die(mysql_error().'<br/>'.$query);

		$query = "insert into appointment_setting (setting_name,setting_value,business_id) values('service_name','$peop','$business_id')";
		mysql_query($query) or die(mysql_error().'<br/>'.$query);

		$query = "insert into appointment_setting (setting_name,setting_value,business_id) values('staff_name','$w','$business_id')";
		mysql_query($query) or die(mysql_error().'<br/>'.$query);

		mysql_query("insert into setup_wizard(business_id,appointment, customer, people, who, duration, buffer, reservation) values('".$business_id."','".$appoint."','".$cust."', '".$peop."', '".$w."','','','')") or die(mysql_error());
		$setup_id = mysql_insert_id();
		header("Location: step2.php?id=$setup_id");

}
?>